package com.zbkj.admin.controller.platform.v2;

import com.zbkj.admin.model.req.EditEmployeeNoReq;
import com.zbkj.admin.model.req.EditEmployeeReq;
import com.zbkj.admin.model.req.EmployeeListReq;
import com.zbkj.admin.model.vo.EmployeeListVO;
import com.zbkj.admin.service.AdminEmployeeV2Service;
import com.zbkj.dal.base.page.CommonPage;
import com.zbkj.dal.base.result.CommonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Api("平台-员工管理")
@RestController
@RequestMapping("/api/admin/platform/v2/employee")
public class PlatformEmployeeV2Controller {

    @Resource
    private AdminEmployeeV2Service adminEmployeeV2Service;

    @ApiOperation(value = "员工列表")
    @GetMapping("/list")
    public CommonResult<CommonPage<EmployeeListVO>> employeeList(EmployeeListReq req) {
        return CommonResult.success(adminEmployeeV2Service.employeeList(req));
    }

    @ApiOperation(value = "编辑员工")
    @PostMapping("/edit")
    public CommonResult<Void> editEmployee(@RequestBody @Validated EditEmployeeReq req) {
        adminEmployeeV2Service.editEmployee(req);
        return CommonResult.success();
    }

    @ApiOperation(value = "修改员工号")
    @PostMapping("/edit/employee-no")
    public CommonResult<Void> editEmployeeNo(@RequestBody @Validated EditEmployeeNoReq req) {
        adminEmployeeV2Service.editEmployeeNo(req);
        return CommonResult.success();
    }

}
